import java.util.Scanner;

public class Demo7 {
    public static int count;
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while (!Thread.currentThread().isInterrupted()) {
                count++;
            }
        },"光头强");
        thread.start();
        System.out.println(thread.getState());
        System.out.println("thread = " + thread.getName());

        Scanner scanner = new Scanner(System.in);
        scanner.nextInt();
        //终止程序
        thread.interrupt();
        System.out.println("count = " + count);

    }
}
